require_once __DIR__ . '/inc/functions.php';
require_once __DIR__ . '/inc/config.php';
// send_mail('info@manufaktur.com',$system['mail_sender'],'Test Mail','Bla bla bla bla');
//**************************************************************************
// Tschüss Internet Explorer
//**************************************************************************
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
{
//MSIE
$modal_content = '
Internet Explorer ';
$modal_content .= 'Den Browser Internet Explorer unterstützen wir nicht mehr. Er ist veraltet und wird inzwischen selbst von Microsoft nicht mehr empfohlen. Bitte besuche uns mit einem der folgenden Browser:
';
$modal_content .= '
- Google Chrome
- Microsoft Edge
- Safari
- Firefox
';
$modal_content .= 'Vielen Dank für Dein Verständnis.
';
}
//***************************************
// Baum diesen Monat?
//***************************************
if (($login['monthLL']>0 || is_null($login['monthLL'])) && $login['iduser']>0 && !$login['locked'])
{
add_trees($login['iduser'],0,$system['activity_points'],4);
$top_message['ok'] = 'Du hast eben einen Baum für Deinen Besuch in diesem Monat erhalten.';
}
//**************************************************************************
// Verify Message
//**************************************************************************
if ($login['iduser']>0 && $login['verified']==0)
{
$top_message['error'] = 'Du hast Deine Mailadresse noch nicht bestätigt! Mail nochmals senden . ';
}
//**************************************************************************
// Get Content
//**************************************************************************
$admin_mode = false;
$maxwidth = false;
$idcategory = 0;
$home_hero = false;
if ($url2=='add' && $login['status']==5)
{
//************************************
// Add Deal
//************************************
$maxwidth = true;
$admin_mode = true;
$html_content= deal_frm($system['country'],0);
}
elseif ($url2=='shops' && $login['status']==5)
{
//************************************
// Shops (Admin Mode)
//************************************
$maxwidth = true;
$admin_mode = true;
$idshop = $url3;
$html_content = shop_frm($system['country'],$idshop,$system['country_code']);
}
elseif ($url2=='dashboard' && $login['status']==5)
{
//************************************
// Dashboard (Admin Mode)
//************************************
$maxwidth = true;
$admin_mode = true;
$html_content = dashboard($system['country']);
}
elseif ($url2=='stats' && $login['status']==5)
{
//************************************
// Stats (Admin Mode)
//************************************
$maxwidth = true;
$admin_mode = true;
$html_content = statsboard($system['country']);
}
elseif ($url2=='edit' && $login['status']==5)
{
//************************************
// Edit Deal (Admin Mode)
//************************************
$maxwidth = true;
$admin_mode = true;
$iddeal = $url3;
$html_content = deal_frm($system['country'],$iddeal);
}
elseif ($url2=='privacy')
{
//************************************
// Privacy Policy Bla Bla
//************************************
$maxwidth=true;
$html_content = privacy();
}
elseif ($url2=='about')
{
//************************************
// Privacy Policy Bla Bla
//************************************
$maxwidth=true;
$html_content = about();
}
elseif ($url2=='member')
{
//************************************
// Member Bla Bla
//************************************
$maxwidth=true;
$html_content = member();
}
elseif ($url2=='deinshop')
{
//************************************
// Shops Bla Bla
//************************************
$maxwidth=true;
$html_content = shops();
}
elseif ($url2=='nextstep')
{
//************************************
// Next Step
//************************************
$maxwidth=true;
$html_content = nextstep();
}
elseif ($url2=='ai')
{
//************************************
// AI
//************************************
$maxwidth=true;
$html_content = sortAI();
}
elseif ($url2=='chatgpt')
{
//************************************
// Chat GPT
//************************************
$maxwidth=true;
$html_content = chatgpt();
}
elseif ($url2=='news')
{
//************************************
// Get the Article
//************************************
$page_no = substr(str_replace('.htm','', $url3),-5);
$iddeal = preg_replace('/[^0-9]/', '', $page_no);
if (is_numeric($iddeal))
{
$maxwidth=true;
$html_content = news($iddeal);
}
else
{
$html_content = home($system['country'],0,0,NULL);
}
}
elseif ($url2=='login' && $login['status'])
{
//************************************
// Login Status
//************************************
$smallwidth = true;
$html_content = login_status($url2);
}
elseif ($url2=='autologin')
{
//************************************
// Auto Login
//************************************
if ($url3)
{
$login_link = explode(";",encrypt_decrypt('decrypt', $url3));
$user_mail = $login_link[0];
$user_pwd = $login_link[1];
setcookie('var1', urlencode(encrypt_decrypt('encrypt', $user_mail)), time()+60*60*24*365, '/','',secure_cookie($dev), true);
setcookie('var2', urlencode(encrypt_decrypt('encrypt', $user_pwd)), time()+60*60*24*365, '/','',secure_cookie($dev), true);
$html_content = home($system['country'],0,0,NULL);
}
else
{
$html_content = home($system['country'],0,0,NULL);
}
}
elseif ($url2=='login')
{
//************************************
// Login Code
//************************************
if ($url3)
{
$sql = 'SELECT iduser FROM user WHERE login_code = convert(:login_code using utf8mb4) collate utf8mb4_bin';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':login_code', $url3);
$stmt->execute();
$row = $stmt->fetch();
if ($row['iduser'])
{
setcookie('refer', $row['iduser'], time()+60*60*24*1, '/','',secure_cookie($dev), true);
}
$modal_content .= register_frm($url3,0,'login');
}
else
{
$modal_content .= login_frm(NULL,0,'login');
//$modal_content .= register_frm($url3,0,'login');
}
$html_content = home($system['country'],0,0,NULL);
}
elseif ($url2=='password')
{
//************************************
// Passwort send
//************************************
if (filter_var($url3, FILTER_VALIDATE_EMAIL))
{
$modal_content .= password_send(NULL,$url3);
}
else
{
$modal_content .= password_send(NULL,NULL);
}
$html_content = home($system['country'],0,0,NULL);
}
elseif ($url2=='verify')
{
//************************************
// Verify Mail
//************************************
$verify_link = explode(";",encrypt_decrypt('decrypt', $url3));
$user_mail = $verify_link[0];
$user_pwd = $verify_link[1];
$sql = 'SELECT iduser, refer_iduser FROM user WHERE user_mail=:user_mail AND user_pwd=:user_pwd AND is_verfied=0;';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':user_mail', $user_mail);
$stmt->bindParam(':user_pwd', $user_pwd);
$stmt->execute();
$row = $stmt->fetch();
if ($row['iduser'])
{
//************************************
// User aktivieren
//************************************
$sql = 'UPDATE user SET is_verfied=1, ip_verify=:ip WHERE iduser=:iduser';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':iduser', $row['iduser']);
$stmt->bindParam(':ip', $system['ip']);
$stmt->execute();
//************************************
// Refer User Daten
//************************************
$sql = 'SELECT iduser, user_mail, is_locked FROM user where iduser=:iduser';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':iduser', $row['refer_iduser']);
$stmt->execute();
$row = $stmt->fetch();
if ($row['iduser'] && !$row['is_locked']) {
//************************************
// Belohnung gutschreiben
//************************************
add_trees($row['iduser'],0,$system['share_points'],3);
$mail_message = '
Baum! ';
$mail_message .= 'Du hast eben '.$system['share_points'].' Baum bekommen, weil sich jemand Dank Dir angemeldet hat. Vielen Dank, dass Du NetandBuy bekannt machst.
';
$mail_message .= '';
send_mail($row['user_mail'],$system['mail_sender'],'Punkte!',$mail_message);
}
$top_message['ok'] = 'Dein Konto ist aktiviert!';
}
$html_content = home($system['country'],0,0,NULL);
}
elseif ($url2=='logout')
{
//************************************
// Logout
//************************************
setcookie('var1', NULL, time()-60*60*24*365, '/');
setcookie('var2', NULL, time()-60*60*24*365, '/');
setcookie('cat', NULL,'', '/','',secure_cookie($dev), true);
header('Location: /');
exit;
}
elseif ($url2=='share' || $url2=='no')
{
//************************************
// Share
//************************************
if ($url2)
{
if ($url5 && is_numeric($url5))
{
$sql = 'SELECT iduser FROM user WHERE iduser=:iduser';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':iduser', $url5);
$stmt->execute();
$row = $stmt->fetch();
if ($row['iduser'])
{
setcookie('refer', $row['iduser'], time()+60*60*24*3, '/','',secure_cookie($dev), true);
}
}
if ($url3=='news')
{
//************************************
// Share News
//************************************
$page_no = substr(str_replace('.htm','', $url4),-5);
$iddeal = preg_replace('/[^0-9]/', '', $page_no);
$sql = 'SELECT deal.iddeal, deal.deal_title, deal.idpix, pix.image_type, pix.image_format
FROM deal
LEFT JOIN pix ON pix.idpix=deal.idpix
WHERE deal.iddeal=:iddeal AND is_archive=0 AND date(end) >=date(now()) AND date(start) <=date(now())';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':iddeal', $iddeal);
$stmt->execute();
$row = $stmt->fetch();
if ($row['iddeal'])
{
$maxwidth = true;
$html_content = news($iddeal);
}
else
{
$top_message['error'] = 'Tut uns leid, der Artikel ist nicht mehr online...';
$html_content = home($system['country'],0,0,NULL);
}
}
elseif ($url3=='shop')
{
//************************************
// Share Shop
//************************************
$page_no = substr(str_replace('.htm','', $url4),-5);
$idshop = preg_replace('/[^0-9]/', '', $page_no);
$sql = 'SELECT shop.idshop FROM shop
INNER JOIN shop_country ON shop_country.idshop = shop.idshop
WHERE shop.idshop=:idshop AND shop_country.idcountry=:idcountry';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':idshop', $idshop);
$stmt->bindParam(':idcountry', $system['country']);
$stmt->execute();
$row = $stmt->fetch();
if ($row['idshop'])
{
$html_content = home($system['country'],$idshop,0,NULL);
}
else
{
$top_message['error'] = 'Tut uns leid, dieser Shop ist nicht mehr gelistet oder in Deinem Land nicht mehr verfügbar.';
$html_content = home($system['country'],0,0,NULL);
}
}
else
{
//************************************
// Nix Shop / News
//************************************
$html_content = home($system['country'],0,0,NULL);
}
}
}
elseif ($url2=='shop')
{
//************************************
// Shop Redirect
//************************************
$idshop = $url3;
//************************************
// Get Shop Data
//************************************
$sql = 'SELECT idshop, shop_url, trees_sponsored from shop WHERE idshop=:idshop';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':idshop', $idshop);
$stmt->execute();
$row = $stmt->fetch();
$trees_sponsored = $row['trees_sponsored'];
$url = $row['shop_url'];
$idshop = $row['idshop'];
if ($idshop)
{
//************************************
// Update Counter
//************************************
if ($login['status']<5)
{
$sql = 'UPDATE shop SET counter=counter+1 WHERE idshop=:idshop';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':idshop', $idshop);
$stmt->execute();
}
//************************************
// Add Trees
//************************************
if ($login['iduser']>0)
{
if ($trees_sponsored>0)
{
$sql = 'UPDATE shop SET counter_sponsor=counter_sponsor+1 WHERE idshop=:idshop';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':idshop', $idshop);
$stmt->execute();
$trees = $trees_sponsored;
}
else
{
$trees = $system['click_points'];
}
//************************************
// Add Trees
//************************************
add_trees($login['iduser'],$idshop,$trees,1);
}
//************************************
// Redirect to Shop
//************************************
//echo 'Redirect ('.$url.'), add trees ('.$trees.')';
header('Location: '.$url.'');
exit;
}
else
{
//************************************
// Kein Shop gefunden
//************************************
$html_content = home($system['country'],0,0,NULL);
}
}
elseif ($url2=='deal')
{
//************************************
// Deal Redirect
//************************************
$iddeal = $url2;
$sql = 'SELECT iddeal, points, url FROM deal WHERE iddeal=:iddeal AND is_archive=0';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':iddeal', $iddeal);
$stmt->execute();
$row = $stmt->fetch();
//************************************
// Update Counter
//************************************
if ($login['status']<5)
{
$sql = 'UPDATE deal SET counter=counter+1 WHERE iddeal=:iddeal';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':iddeal', $row['iddeal']);
$stmt->execute();
}
if ($row['iddeal'] && $iddeal)
{
$points = $row['points'];
$url = $row['url'];
if ($login['iduser']>0)
{
//************************************
// Login, Points?
//************************************
// WHERE date(ins_date) = date(now()) AND iduser=:iduser AND iddeal=:iddeal AND what=1';
$sql = 'SELECT iduser_point FROM user_point
WHERE iduser=:iduser AND iddeal=:iddeal AND what=1';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':iduser', $login['iduser']);
$stmt->bindParam(':iddeal', $iddeal);
$stmt->execute();
$row = $stmt->fetch();
if (!$row['iduser_point'])
{
//************************************
// Add Trees
//************************************
add_points($login['iduser'],$iddeal,$points,1);
if ($dev==true)
{
$html_content .='Redirect, add points. '.$url;
}
else
{
header('Location: '.$url.'');
exit;
}
}
else
{
//************************************
// No Points
//************************************
if ($dev==true)
{
$html_content .='Redirect, no points. '.$url;
}
else
{
header('Location: '.$url.'');
exit;
}
}
}
else
{
//************************************
// No Login, no Points
//************************************
if ($dev==true)
{
$html_content .='Redirect, no points. '.$url;
}
else
{
header('Location: '.$url.'');
exit;
}
}
}
else
{
//************************************
// Kein Deal gefunden
//************************************
$html_content = home($system['country'],0,0,NULL);
}
}
else
{
//************************************
// Home, sweet home
//************************************
$maxwidth = false;
if ($url2)
{
//************************************
// Check Category
//************************************
$category = strtolower($url2);
$sql = 'SELECT idcategory, category_name FROM category WHERE category_url = :category';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':category', $category);
$stmt->execute();
$row = $stmt->fetch();
if ($row['idcategory'])
{
$idcategory = $row['idcategory'];
$system['meta_title'] = $row['category_name'].' | '.$system['meta_title'];
$system['meta_desc'] = $system['country_name'] .': '.$system['meta_desc'];
}
else
{
$idcategory = 0;
}
//echo $category.' | '.$idcategory;
//************************************
// Check Keyword
//************************************
$keyword = strtolower($url2);
// echo $keyword;
$sql = 'SELECT count(idkeywords) as anzKeywords FROM keywords WHERE keyword=:keyword';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':keyword', $keyword);
$stmt->execute();
$row = $stmt->fetch();
$anzKeywords = $row['anzKeywords'];
// echo $keyword.' | '.$anzKeywords;
if ($idcategory>0)
{
$html_content = home($system['country'],0,$idcategory,NULL);
}
elseif ($anzKeywords>0)
{
$html_content = home($system['country'],0,0,$keyword);
}
else
{
$html_content = home($system['country'],0,0,NULL);
}
}
else
{
//************************************
// Default View
//************************************
$html_content = home($system['country'],0,0,NULL);
}
}
//**************************************************************************
// Splash Screen
//**************************************************************************
if ($_COOKIE['cookie_ok']<>'yes' && $url1<>'privacy' && $url1<>'suggest' && $url1<>'login')
{
//************************************
// Promo Code
//************************************
$sql = 'SELECT code, points FROM code WHERE idcountry=:idcountry AND date(code_to) >= date(now()) AND date(code_from) <= date(now())';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':idcountry', $system['country']);
$stmt->execute();
$row = $stmt->fetch();
if ($row['points'])
{
$code = $row['code'];
$poinsts = $row['points'];
$code_msg = 'Registriere Dich jetzt mit dem Code '.$code.' und Du bekommst '.$poinsts.' Punkte.';
}
//************************************
// Cookie?
//************************************
$sql = 'SELECT * FROM splash WHERE idcountry=:idcountry order by step;';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':idcountry', $system['country']);
$stmt->execute();
$SplashScreens = $stmt->rowCount();
if ($stmt->rowCount() > 0)
{
while ($row = $stmt->fetch())
{
$iSplash++;
if ($row['step']==1)
{
$splash_content .='';
}
else
{
$splash_content .='
';
}
$splash_content .= '
Skip
';
$splash_content .= '
';
$splash_content .= '
'.$row['title'].' ';
if ($row['sub'])
{
$splash_content .= '
'.$row['sub'].'
';
if ($row['code_msg'] && $code_msg)
{
$splash_content .= '
'.$code_msg.'
';
}
}
$splash_content .= '
';
$splash_content .= '
';
if ($SplashScreens==$row['step'])
{
$splash_content .= '
Mitmachen
';
}
else
{
$splash_content .= '
'.$row['button'].'
';
}
$splash_content .= '
';
$splash_content .= '
';
for ($x = 1; $x <= $SplashScreens; $x++)
{
if ($x==$iSplash)
{
$splash_content .= ' ';
}
else
{
$splash_content .= ' ';
}
}
$splash_content .= '
';
$splash_content .= '
';
}
}
}
//**************************************************************************
// Deal Meta Tags
//**************************************************************************
function meta_tags($headline,$img,$url1,$url2,$url3,$url4)
{
global $system;
$system['meta_title'] = $headline;
$system['meta_img'] = $img;
//$system['meta_url'] = '/'.$url1.'/'.$url2.'/'.$url3;
//$system['canonical'] = '/'.$url1.'/'.$url2;
$system['meta_desc'] = 'Deal #'.$url2.': '.$system['meta_desc'];
}
//**************************************************************************
// Start Page
//**************************************************************************
$css_version = substr(filemtime(__DIR__.'/styles.min.css'),-4);
$js_version = substr(filemtime(__DIR__.'/scripts.min.js'),-4);
echo '';
echo '';
if (isset($nav_slider))
{
echo '';
}
else
{
echo '';
}
echo '';
echo '
';
echo '
';
if ($dev)
{
echo '
DEV! '.$system['meta_title'].' ';
}
else
{
echo '
'.$system['meta_title'].' ';
}
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
if ($system['canonical'])
{
echo '
';
}
//**************************************************************************
// Matomo Stats
//**************************************************************************
echo '
';
echo '';
echo '';
//*********************************
// Navbar
//*********************************
echo '
'; //has-shadow
echo '';
echo '';
if (!$admin_mode)
{
echo '
';
$sql = 'SELECT country_code, country_name, country_flag FROM country
INNER JOIN country_world ON country_world.idcountryworld = country.idcountryworld
ORDER BY FIELD(country_code, :country_code) DESC';
$stmt = DBi::$conn->prepare($sql);
$stmt->bindParam(':country_code', $system['country_code']);
$stmt->execute();
$i=0;
while ($row = $stmt->fetch())
{
if ($i==0)
{
echo '
';
echo ' ';
echo ' ';
echo '
';
echo '
';
}
if ($login['status']==5)
{
echo '
';
echo ' ';
echo ' ';
if ($admin_mode)
{
echo '
';
echo ' ';
echo ' ';
echo '
';
echo ' ';
echo ' ';
}
}
if (!$admin_mode)
{
echo '
';
echo ' ';
echo ' ';
}
echo '
';
echo ' ';
//***************************************
// Category Nav (Slider on Mobile)
//***************************************
if (isset($nav_slider))
{
$sql='SELECT category_name, idcategory, category_url FROM category WHERE is_active=1 ORDER by sort';
$stmt = DBi::$conn->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0)
{
$html = '
';
echo $html;
}
}
//********************************
// System Message
//********************************
//$top_message['ok'] = 'Passwort: '.encrypt_decrypt('decrypt', urldecode('QlhWYWpMUnJBcldDZkxHUHNIWmNhZz09'));
if (isset($top_message['ok']))
{
echo '
'.$top_message['ok'].'
';
}
elseif (isset($top_message['error']))
{
echo '
'.$top_message['error'].'
';
}
//**************************************************************************
// Main
//**************************************************************************
if ($home_hero)
{
//********************************
// Home Her0
//********************************
echo '
';
echo '';
echo '
';
echo '';
echo ' ';
echo '';
echo '
Willkommen bei SOORT ';
echo '
Wir helfen Dir nachhaltige Produkte zu finden
';
echo '
Mitmachen ';
echo '
';
echo ' ';
echo '';
echo ' ';
echo '';
echo '
650 Shops sind schon onboard ';
echo '
Alle handverlesen, geprüft, nachhalting und voller Inspiration
';
echo '
Mitmachen ';
echo '
';
echo ' ';
echo '';
echo ' ';
echo '';
echo '
Tr/oy - dein Shopping Assistent ';
echo '
Unsere KI findet für dich individuelle Shops und erläutert dir auch den Unterschied. Probiere es aus. „Schmuck, 5 Shops mit Link“.
';
echo '
Mitmachen ';
echo '
';
echo ' ';
echo '';
echo ' ';
echo '';
echo '
Mach mit und sei Teil des Wandels! ';
echo '
Werde kostenfreies Mitglied und als Dankeschön pflanzen wir einen Baum für die Natur und unser Klima.
';
echo '
Mitmachen ';
echo '
';
echo ' ';
echo ' ';
echo '
';
echo ' ';
//echo '
';
}
//********************************
// Content
//********************************
echo '
';
if ($maxwidth)
{
echo '';
echo $html_content;
echo '
';
}
elseif(isset($smallwidth))
{
echo '';
echo $html_content;
echo '
';
}
else
{
echo '';
echo $html_content;
echo '
';
}
echo ' ';
echo '';
echo '';
//***********************************
// Chatbase
//***********************************
echo '
';
//***********************************
// Modals (Modal & Splash Screen)
//***********************************
echo '
';
echo '
';
if (isset($splash_content))
{
echo '
'.$splash_content.'
';
}
if (isset($modal_content))
{
echo '
'.$modal_content.'
';
}
else
{
echo '
';
}
echo '';
echo '';
?>